package com.sfh.cpc.mass.adapter;

import android.text.TextUtils;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sfh.cpc.R;
import com.sfh.cpc.com.BaseAppContent;
import com.sfh.cpc.com.ImageLoaderEngine;
import com.sfh.cpc.com.entity.EMass;
import com.sfh.cpc.com.widget.VIPMassView;

/**
 * 功能描述: TODO
 *
 * @author SunFeihu 孙飞虎
 * @date 2018/8/27
 */
public class MassAdapter extends BaseQuickAdapter<EMass, BaseViewHolder> {

    public MassAdapter() {
        super(R.layout.mass_fragment_adapter);
    }

    @Override
    protected void convert(BaseViewHolder helper, EMass item) {
        helper.setText(R.id.tvTitle, item.getMassTitle());
        helper.setText(R.id.tvSize, item.getNoteSize()+" 帖");
        helper.setText(R.id.tvContent, item.getMassContent());
        VIPMassView vipMassView = helper.getView(R.id.vipMassView);
        vipMassView.showVIP(item);

        ImageView iv = helper.getView(R.id.ivHeader);

        if (!TextUtils.isEmpty(item.getMassUrl())) {
            new ImageLoaderEngine(iv, BaseAppContent.getImageUrl(item.getMassUrl())).roundTransformCenterCrop(7).into(iv);
        }
    }
}
